import { request } from "@/utils/request";

/** MOCK数据 */
export interface ActivityInfo {
  [key: string]: any;
  id: number;
  image?: string;
  name?: string;
  cname?: string;
  mobile?: string;
  email?: string;
  date?: string;
  datetime?: string;
  id_card?: string;
  ip?: string;
  url?: string;
  county?: string;
  csentence?: string;
  boolean?: boolean;
};

/** 获取活动列表 GET /api/active/list */
export async function getList(params: Record<string, any>) {
  return request<API.PagedList<any>>(`/api/activity/list`, {
    method: "GET",
    params,
  });
}

/** 获取活动详情 GET /api/activity/info */
export async function getDetail(params: Record<string, any>) {
  return request<API.PagedList<any>>(`/api/activity/info`, {
    method: "GET",
    params,
  });
}

/** 查询活动是否被用户收藏 GET /api/activity/iscollect */
export async function getIsCollect(params: Record<string, any>) {
  return request(`/api/activity/iscollect`, {
    method: "GET",
    params,
  });
}

/** 更新收藏状态 GET /api/activity/collect */
export async function updateCollectStatus(data: Record<string, any>) {
  return request(`/api/activity/collect`, {
    method: "POST",
    data,
  });
}

/** 参加活动 GET /api/activity/apply */
export async function applyActivity(data: Record<string, any>) {
  return request(`/api/activity/apply`, {
    method: "POST",
    data,
  });
}

/** 获取活动分享信息 GET /api/activity/share */
export async function getShareInfo(params: Record<string, any>) {
  return request<API.PagedList<any>>(`/api/activity/share`, {
    method: "GET",
    params,
  });
}

/** 获取用户活动列表 GET /api/user/active/list */
export async function getListByUser(params: Record<string, any>) {
  return request<API.PagedList<any>>(`/api/user/active/list`, {
    method: "GET",
    params,
  });
}

/** 获取用户活动详情 GET /api/user/active/info */
export async function getActivityDetailByUser(params: Record<string, any>) {
  return request<API.PagedList<any>>(`/api/user/active/info`, {
    method: "GET",
    params,
  });
}

/** 取消参加活动 POST /api/user/order/cancel */
export async function cancelActivity(data: Record<string, any>) {
  return request<API.PagedList<any>>(`/api/user/order/cancel`, {
    method: "POST",
    data,
  });
}

/** 获取首页推荐活动列表 GET /api/index/activity */
export async function getActivityByHome(params: Record<string, any>) {
  return request<API.PagedList<any>>(`/api/index/activity`, {
    method: "GET",
    params,
  });
}
